package com.skyon.rule.res.client;

import java.util.HashMap;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.skyon.rule.res.model.InputParam;
import com.skyon.rule.res.model.InputUrlAdapter;
import com.skyon.rule.res.model.OutputParam;
import com.skyon.rule.res.remoteInvoke.PlotInterface;

public class SpringHttpClient {
	public static void main(String[] args) throws Exception {
		ApplicationContext context = new ClassPathXmlApplicationContext("/spring/invoker-client.xml");
		PlotInterface plotResource = (PlotInterface) context.getBean("spiProxy");
		
		InputParam inpp = new InputParam(new InputUrlAdapter("com.ccb.tfs.n2tfs/sample?return=Message"));
		
		inpp.getBeansMap().put("Message", new HashMap<String, Object>());
		inpp.getBeansMap().get("Message").put("message", "RRRRRRRRRRRRRR");
		
		OutputParam otpp = plotResource.callService(inpp);
		
		System.out.println("otpp.getPlotId() = " + otpp.getPlotId());
		System.out.println("otpp.getParamMap().get(\"message\") = " +otpp.getBeansMap().get("Message").get("message"));
		
	}
}
